/************************************************************************
 * AIDE/Examples - Automata Identification Engine
 * Copyright (C) 2012-2013 Ali Khalili (khalili_DOT_ir_@SIGN_gmail_DOT_com)
 * **********************************************************************
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License (LGPL) published 
 * by the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version. This program is distributed without any
 * warranty. See the GNU Lesser General Public License for more details. 
 * ***********************************************************************
 * File         :     
 * Description  :     
 * Change log   :     	-Date:  Change
 ************************************************************************/
﻿using System;
using System.Collections.Generic;
using SMLib.Automata.Base;
using SMLib.Automata.MM;
using AIDE.OfflineAlgo.NFMs;

namespace LearningApp.Examples
{
    class OfflineMMLearning
    {
        /// <summary>
        /// The main funtion to run the example
        /// </summary>
        public static void RunExample()
        {
            //* we define the alphabet
            Alphabet alph_i = new Alphabet();

            ISymbol zero = new StringSymbol("0"), one = new StringSymbol("1");
            ISymbol a = new StringSymbol("a"), b = new StringSymbol("b");
            alph_i.AddSymbols(a, b);

            List<Sequence> sqs = new List<Sequence>();
            sqs.Add(new Sequence().AddPairs(a, one, b, zero));
            sqs.Add(new Sequence().AddPairs(b, zero, b, one, a, zero));
            sqs.Add(new Sequence().AddPairs(b, zero, a, zero, a, one));

            RPNI_MM learner = new RPNI_MM(alph_i, sqs);
            MealyMachine conj = learner.Learn();
			
			//* Use GLEE? if yes, we can visualize the conjecture            
            //AIDE.Automata.Utils.AutomataUtils.DrawAutomata(conj);
			
			//* if not? we can save it in a dot file
			SMLib.Interoperability.DOT.DotHelper_MM.WriteToDot("exampleMM.dot",conj);
        }
    }
}
